﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Alex.Library.Cloud.Libs;

namespace Alex.Library.Cloud.VMWare.V51.VMMParameters
{
    public class VMCloneParameter : IVMMParameter
    {
        public VMCloneParameter(string dcName, string vmPath, string cloneName)
        {
            this.DatacenterName = dcName;
            this.VMPath = vmPath;
            this.CloneName = cloneName;
        }

        public VMCloneParameter()
            : this(string.Empty, string.Empty, string.Empty)
        {

        }

        public string DatacenterName { get; set; }

        public string VMPath { get; set; }

        public string CloneName { get; set; }

        public bool IsValid()
        {
            bool isValid = true;
            StringBuilder sb = new StringBuilder();
            if (String.IsNullOrEmpty(DatacenterName))
            {
                sb.AppendLine("DatacenterName is empty or null.");
                isValid = false;
            }
            if (String.IsNullOrEmpty(VMPath))
            {
                sb.AppendLine("VMPath is empty or null.");
                isValid = false;
            }
            if (String.IsNullOrEmpty(CloneName))
            {
                sb.AppendLine("CloneName is empty or null.");
                isValid = false;
            }
            ErrorMessage = sb.ToString();
            return isValid;
        }

        public string ErrorMessage { get; private set; }
    }
}
